package com.first.server.controller.admin;

import com.first.common.result.PageResult;
import com.first.common.result.Result;
import com.first.pojo.dto.PlaceWorkUserDTO;
import com.first.pojo.dto.PlaceWorkUserPageQueryDTO;
import com.first.pojo.dto.UserPageQueryDTO;
import com.first.server.service.PlaceService;
import com.first.server.service.PlaceWorkUserService;
import com.first.server.service.UserService;
import com.first.server.service.WorkService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Slf4j
@RestController
@Api(tags = "基地、成果、用户关系接口")
@RequestMapping("admin/pwu")
public class PlaceWorkUserController {
    @Autowired
    private UserService userService;
    @Autowired
    private PlaceService placeService;
    @Autowired
    private PlaceWorkUserService placeWorkUserService;

    @GetMapping("/page")
    @ApiOperation("分页查询")
    public Result<PageResult> page(PlaceWorkUserPageQueryDTO placeWorkUserPageQuery) {
        log.info("分页查询：{}",placeWorkUserPageQuery);
        PageResult pageResult = placeWorkUserService.pageQuery(placeWorkUserPageQuery);
        return Result.success(pageResult);
    }

    @PostMapping("/add")
    @ApiOperation("添加基地成果")
    public Result addWorkToPlace(@RequestBody PlaceWorkUserDTO placeWorkUserDTO){
        log.info("添加成果信息：{}",placeWorkUserDTO);
        placeWorkUserService.addWorkToPlace(placeWorkUserDTO);
        return Result.success();
    }




}
